package day15;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;

public class testcollection01 {
    public static void main(String[] args) {
        Collection<String> c1=new ArrayList<>();
        c1.add("风");
        c1.add("火");
        c1.add("山");
        c1.add("林");
        Collection<Integer> c2=new ArrayList<>();
        c2.add(1);
        c2.add(2);
        c2.add(3);
        c2.add(4);
        Collection<Integer> c3=new ArrayList<>();
        c3.add(3);
        c3.add(4);
        c3.add(7);
        c3.add(8);
        System.out.println(c1);
        System.out.println(c1.hashCode());
        System.out.println(c1.contains("风"));//true
        System.out.println(c1.isEmpty());//false
        System.out.println(Arrays.toString(c1.toArray()));
        System.out.println(c2.addAll(c3));
        System.out.println(c2);
        System.out.println(c2.containsAll(c3));//true
//        System.out.println(c2.removeAll(c3));
        System.out.println(c2);
        System.out.println(c2.retainAll(c3));
        System.out.println(c2);
        Iterator<Integer> it = c2.iterator();
        while (it.hasNext()){
            System.out.print(it.next()+",");
        }

    }
}
